package h0726;

import java.util.Scanner;

public class CarsStatistic {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        String str = s.replaceAll("111", "x").replaceAll("11", "x").replaceAll("1", "x");
        int ans=0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i)=='x'){
                ans++;
            }
        }
        System.out.println(ans);
    }
}
